package com.wingice.system.validator.sys.oauthclientresource;

import com.wingice.system.exception.SysBusinessCode;
import com.wingice.system.exception.SysBusinessException;
import com.wingice.system.validator.BaseValidator;
import com.wingice.system.vo.UserRoleResourceVo;
import org.springframework.util.StringUtils;

/**
 * @author 胡昊
 * Description:
 * Date: 2022/1/10
 * Time: 10:44
 * Mail: huhao9277@gmail.com
 */
public class SysOauthClientResourceValidator extends BaseValidator {

    public static void saveOauthClientResource(UserRoleResourceVo userRoleResourceVo) {
        if (!StringUtils.hasText(userRoleResourceVo.getOauthClientId())) {
            throw new SysBusinessException(SysBusinessCode.OAUTH_CLIENT_ID_EMPTY_ERROR);
        }
        if (userRoleResourceVo.getResourceIdList() == null) {
            throw new SysBusinessException(SysBusinessCode.RESOURCE_ID_LIST_NOT_EXIST_ERROR);
        }
    }
}
